package com.atguigu01.net;

import org.junit.Test;

import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * ClassName: NetTest
 * Package: com.atguigu01.net
 * Description:
 *
 * @Author BuTang
 * @Create 2023/6/20 15:37
 * @Version 1.0
 */
public class NetTest {
    @Test
    public void test() throws UnknownHostException {
        //实例化一个对象localHost
        InetAddress inet = InetAddress.getLocalHost();
        System.out.println(inet);
        //实例化一个对象byname
        InetAddress newIp = InetAddress.getByName("192.168.10.55");
        System.out.println(newIp);
    }
}
